<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .chart {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="chart"></div>
    <script src="./echarts.min.js"></script>
    <script>
      // 初始化实例对象
      const myEcharts = echarts.init(document.querySelector(".chart"));
      // 定义配置项
      const option = {
        xAxis: {
          type: "category", // 如果写了data，那么就不用type
        },
        yAxis: {},
        dataset: {
          source: [
            ["星期一", 11, 22, "zs", 55],
            ["星期二", 15, 32, "ls", 66],
            ["星期三", 21, 20, "wu", 77],
            ["星期四", 30, 10],
            ["星期五", 26, 23],
            ["星期六", 19, 28],
            ["星期天", 23, 19],
          ],
        },
        series: [
          {
            type: "line",
            // 使用dataset中的数据
            encode: { x: 0, y: 1 },
          },
          {
            type: "bar",
            // 使用dataset中的数据
            encode: { x: 0, y: 2 },
          },
          {
            type: "pie",
            // 使用dataset中的数据
            encode: { itemName: 3, value: 4 },
            radius: 30,
            center: [600, 50],
          },
        ],
      };
      // 进行配置
      myEcharts.setOption(option);
    </script>
  </body>
</html>
